@prefix: side;
@mobile: ~'only screen and (max-width: 578px)';
@desktop: ~'only screen and (min-width: 768px)';

@media @mobile {
  .@{prefix}-menu-wrapper {
    &::before {
      z-index: 100;
      position: fixed;
      top: 50px;
      right: 0;
      bottom: 0;
      left: 0;
      content: '';
      opacity: 0;
      visibility: hidden;
      background-color: rgba(0, 0, 0, 0.3);
      transition: all 0.2s ease-out;
    }

    &[data-mobile-show] {
      &::before {
        opacity: 1;
        visibility: visible;
        transition-timing-function: ease-in;
      }
    }
  }
}

.@{prefix}-menu {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background-color: #f2f5fa;
  box-sizing: border-box;
  transition: left 0.3s;
  display: none;

  @media @mobile {
    left: -240px;
    top: 50px;
    display: block !important;
    width: 240px;
    background-color: #fff;

    &[data-mobile-show] {
      left: 0;
      .@{prefix}-menu-inner {
        z-index: 1;
        position: relative;
        box-shadow: 1px 0 2px 0 rgba(0, 0, 0, 0.1);
      }

      .@{prefix}-menu-toggle {
        &-icon {
          background-color: transparent;

          &::before,
          &::after {
            top: 50%;
            left: 50%;
            width: 20px;
            background-color: #333;
            transform: translate(-50%, -50%) rotate(45deg);
          }

          &::after {
            transform: translate(-50%, -50%) rotate(-45deg);
          }
        }
      }
    }
  }

  &-inner {
    width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;

    [data-prefers-color='dark'] & {
      background-color: #262626;
    }
  }

  .menu-list {
    min-height: 100%;
    font-family: PingFangSC-Regular, "PingFang SC", serif;


    .menu-item-title {
      line-height: 40px;
      color: #333333;
      font-size: 14px;
    }

    .sub-menu-item-title {
      line-height: 40px;
      cursor: pointer;
    }

    .sub-menu-item {
      color: #333333;
      font-size: 14px;
    }

    .is-active {
      background: rgba(35, 134, 238, 0.1);
      color: #3863ff;
      border-left: 4px solid;

      a {
        color: #3863ff !important;
        transform: translateX(-4px);
      }
    }

    a {
      display: inline-block;
      width: 100%;
      height: 100%;
      color: #333333;
    }

    .menu-components-wapper {
      & > ul > li.menu-item-title {
        font-size: 14px;
        font-weight: 400;
        color: #666666;
        line-height: 20px;
      }

      & > ul > li.sub-menu-item .menu-item-title a {
        font-size: 14px;
        font-weight: 400;
        color: #212121;
        line-height: 20px;
      }

      .menu-item-title {
        padding-left: 40px;

        &:hover {
          a {
            color: #276FF5 !important;
          }
        }

        &.is-active {
          padding-left: 36px;
        }
      }

      > .menu-item-title, > ul > .menu-item-title {
        font-size: 14px;
        margin: 6px 0;
      }

      .sub-menu-item {
        .menu-item-title {
          padding-left: 60px;
        }
      }
    }
  }

  &-toggle {
    z-index: 0;
    position: absolute;
    top: 72px;
    right: -40px;
    display: none;
    width: 40px;
    height: 40px;
    border: 0;
    outline: none;
    box-shadow: 0 2px 14px 0 rgba(0, 0, 0, 0.1);
    border-radius: 0 4px 4px 0;
    background-color: #fff;

    &-icon {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 14px;
      height: 2px;
      background-color: #999;
      transform: translate(-50%, -50%);
      transition: all 0.2s linear;

      &::before,
      &::after {
        position: absolute;
        top: -6px;
        left: 0;
        width: 14px;
        height: 2px;
        content: '';
        background-color: #999;
        transition: 0.2s all 0.2s;
      }

      &::after {
        top: auto;
        bottom: -6px;
      }
    }

    @media @mobile {
      display: block;
    }
  }
}
